import sqlite3

conn = sqlite3.connect('../database.db')
conn.row_factory = sqlite3.Row

for i in range(970, 1533):
    table_name = 'gate_pass_info_{}'.format(i)
    sql = 'select count(*) from {}'.format(table_name)
    sql_count = tuple(conn.execute(sql).fetchone())[0]
    file_line_count = 0
    with open('../gate_pass_info/{}'.format(table_name), 'r', encoding='utf8') as f:
        for line in f:
            file_line_count += 1
    if sql_count != file_line_count:
        print('{} count result: sql_count is {}, file_line_count is {}, equal is {}'.format(table_name, sql_count, file_line_count, sql_count == file_line_count))
    else:
        print('{} compare finish'.format(table_name))